@extends('Admin.layouts.common')

@section('content')
    <div class="container myContainer">
        @if(count($errors))
            <div class="alert alert-danger">
                <ul>
                    @foreach($errors->all() as $err)
                        <li>{{ $err }}</li>
                    @endforeach
                </ul>
            </div>
        @endif
        <button class="btn btn-info searchBtn" onclick="$('.search_box').slideToggle();">搜索/筛选</button>
        <div class="search_box">
            <form id="search_form" method="GET">
               <label>
                 <label>
                    添加时间：<br>
                    <input name="add_time" id="add_time" type="text" class="form-control search_form_control daterange_picker" value="{{urldecode($_search['add_time'])}}">              
                </label>
                <label>
                    注册渠道：<br>
                        <select name="channel_id" class="form-control search_form_control">
                            <option value="">全部</option>
                              @foreach($data['name_channel'] as $k => $v)
                                  <option value="{{$k}}" {{$_search['channel_id'] == $k ? 'selected' : ''}}>{{$v}}</option>
                              @endforeach
                        </select>
                </label>
                <br>
                <button class="btn btn-primary" type="submit">&nbsp;&nbsp;确定&nbsp;&nbsp;</button>
            </form>
        </div>
        <div id="order_tag"></div>
        <div class="table-responsive">
            <table class="table">
                <caption>渠道统计列表</caption>
                <thead>
                    <tr>
                        <th><a href="javascript:void(0);" data-order="id">id</a></th>
                        <th><a href="javascript:void(0);" data-order="channel_id">渠道id</a></th>
                        <th><a href="javascript:void(0);" data-order="channel_name">渠道名称</a></th>
                        <th><a href="javascript:void(0);" data-order="add_time">添加时间</a></th>
                         <th><a href="javascript:void(0);" data-order="ymd ">添加月份</a></th>
                        <th><a href="javascript:void(0);" data-order="recharge_count">充值笔数</a></th>
                        <th><a href="javascript:void(0);" data-order="recharge_sum">充值总和</a></th>
                        <th><a href="javascript:void(0);" data-order="withdraw_count">提现笔数</a></th>
                        <th><a href="javascript:void(0);" data-order="withdraw_sum">提现总和</a></th>
                        <th><a href="javascript:void(0);" data-order="register_count">注册数</a></th>
                        <th><a href="javascript:void(0);" data-order="trad_buy_number">买入笔数</a></th>
                        <th><a href="javascript:void(0);" data-order="trad_buy_amount">买入总和</a></th>
                        <th><a href="javascript:void(0);" data-order="trad_sell_number">卖出笔数</a></th>
                        <th><a href="javascript:void(0);" data-order="trad_sell_amount">卖出总和</a></th>
                    </tr>
                </thead>
                <tbody>
                    @forelse($list->items() as $item)
                        <tr>
                            <td>{{ $item->id }}</td>
                            <td>{{ $item->channel_id }}</td>
                            <td>{{ isset($data['name_channel'][$item->channel_id])?$data['name_channel'][$item->channel_id]:''}}</td>
                            <td>{{ $item->add_time }}</td>
                            <td>{{ $item->ymd  }}</td>
                            <td>{{ $item->recharge_count }}</td>
                            <td>{{ $item->recharge_sum }}</td>
                            <td>{{ $item->withdraw_count }}</td>
                            <td>{{ $item->withdraw_sum }}</td>
                            <td>{{ $item->register_count }}</td>
                            <td>{{ $item->trad_buy_number }}</td>
                            <td>{{ $item->trad_buy_amount }}</td>
                            <td>{{ $item->trad_sell_number }}</td>
                            <td>{{ $item->trad_sell_amount }}</td>
                        </tr>
                    @empty
                        <tr><td class="text-center" colspan="12">没有数据</td></tr>
                    @endforelse
                </tbody>
            </table>
            <div class="text-center">
                {{ $list->links() }}
            </div>
        </div>

    </div>
@endsection
@section('foot')
<script type="text/javascript">
$(document).ready(function(){
@if(!$_search['add_time'])
    $('#add_time').val('');
@endif
}); 
</script> 
@endsection